import 'package:cher_flare/utils/app_color.dart';
import 'package:flutter/material.dart';
import 'package:svgaplayer_flutter/player.dart';

class LYVoiceRecorderPage extends StatefulWidget {
  final bool isRecording;
  const LYVoiceRecorderPage({super.key, this.isRecording = false});

  @override
  State<LYVoiceRecorderPage> createState() => _LYVoiceRecorderPageState();
}

class _LYVoiceRecorderPageState extends State<LYVoiceRecorderPage> {
  @override
  Widget build(BuildContext context) {
    return IgnorePointer(
      child: Container(
        color: colorWithRGBA(r: 0, g: 0, b: 0, a: 0.3),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.end,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            widget.isRecording
                ? Container(
                    alignment: Alignment.center,
                    width: 131,
                    height: 84,
                    child: const SVGASimpleImage(
                      assetsName: 'assets/svgas/voice_recording.svga',
                    ))
                : Image.asset(
                    'assets/images/voice_record_cancel.png',
                    width: 131,
                    height: 84,
                  ),
            const SizedBox(
              height: 134,
            ),
            Container(
              height: 158,
              padding: const EdgeInsets.only(top: 24),
              alignment: Alignment.topCenter,
              decoration: const BoxDecoration(
                  image: DecorationImage(
                      image: AssetImage('assets/images/record_bg.png'),
                      fit: BoxFit.fill)),
              child: Image.asset(
                widget.isRecording
                    ? 'assets/images/microphone_h.png'
                    : 'assets/images/microphone_n.png',
                width: 62,
                height: 62,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
